package com.ittony.mapper;

import com.github.pagehelper.Page;
import com.ittony.annotation.AutoFill;
import com.ittony.dto.DishDTO;
import com.ittony.dto.DishPageQueryDTO;
import com.ittony.entity.Dish;
import com.ittony.enumeration.OperationType;
import com.ittony.vo.DishVO;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface DishMapper {
    Integer countByCategoryId(@Param("categoryId") Long categoryId);

    @AutoFill(OperationType.INSERT)
    void addDish(Dish dish);

    Page<DishVO> dishPage(DishPageQueryDTO dishPageQueryDTO);

    @Select("select * from dish where id = #{id}")
    Dish getById(Long id);

    @Delete("delete from dish where id = #{id}")
    void deleteById(Long id);

    @AutoFill(OperationType.UPDATE)
    void modifyDish(Dish dish);

    List<Dish> list(Dish dish);

    List<Dish> getBySetmealId(Long id);

    Integer countByMap(Map map);
}
